import SwiftUI
struct Submit: View {
    var title: String
    var onBackTap: () -> Void
    var onImageTap: () -> Void
  // @StateObject private var adManager = InterstitialAdManager()

    var body: some View {
         
        VStack (spacing:0){
           
            ZStack {
                Rectangle()
                    .frame(height: UIApplication.statusBarHeight+54)
                    .foregroundColor(Color( "mainback"))
                    .edgesIgnoringSafeArea(.top)
                HStack{
                   
                    Image("back")
                        .resizable()
                        .aspectRatio(contentMode: .fill)
                        .frame(width: 24, height: 25)
                        .onTapGesture {
                            
                           // adManager.showInterstitial()

                            self.onBackTap() // 点击时调用闭包
                        }
                    
                    Spacer()
                    Text(title)
                        .font(.title)
                        .foregroundColor(Color.white)
                        .bold()
                    Spacer()
                    
                  
                Image("submit")
                    .resizable()
                    .aspectRatio(contentMode: .fill)
                    .frame(width: 24, height: 25)
                    .onTapGesture {
                        
                       // adManager.showInterstitial()

                        self.onImageTap()
                    }
                }.padding(.horizontal,20)
            }.frame(height: 44)
         
        }
        
    }
  
}

#Preview {
    Submit(title: "我爱心心",
       onBackTap: {
      
  }, onImageTap: {
      
  })
}
